package com.apes.scm.masterdata.car.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * Created by lishikun on 2021/12/16 16:43
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = MasCarBrand.CONST_TABLE_NAME)
public class MasCarBrand extends Model {
    public static final String CONST_TABLE_NAME = "mas_car_brand";

    @Id
    @Column(name = "id", length = 4)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "汽车品牌表",padding = 4)
    @Comment("编码")
    private String id;

    @Column(name = "name", nullable = false, length = 120)
    @Comment("汽车品牌名称")
    private String name; //汽车品牌名称

    @Column(name = "valid", nullable = false, columnDefinition = "number(1,0) default 1")
    @Comment("有效标记")
    private boolean valid; //有效
}
